﻿using System.Windows.Controls;

namespace VMWareLabWorkflowsDataContracts.VMWareLabDetailsDialogControls
{
    using VMWareLabWorkflowsDataContracts.VMWareLabDetailsDialogControls.ViewModel;

    /// <summary>
    /// Interaction logic for BuildDetailsControl.xaml
    /// </summary>
    public partial class EnvironmentDetailsControl : UserControl
    {
        public EnvironmentDetailsViewModel EnvironmentDetailsViewModel { get; set; }
        public EnvironmentDetailsControl()
        {
            InitializeComponent();
            this.EnvironmentDetailsViewModel = new EnvironmentDetailsViewModel();
            this.DataContext = this.EnvironmentDetailsViewModel;
            this.tbPassword.Password = this.EnvironmentDetailsViewModel.VmWareLabEnvironmentDetails.Password;
        }

        /// <summary>
        /// Handles the PasswordChanged event of the tbPassword control.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="System.Windows.RoutedEventArgs"/> instance containing the event data.</param>
        private void tbPassword_PasswordChanged(object sender, System.Windows.RoutedEventArgs e)
        {
            this.EnvironmentDetailsViewModel.VmWareLabEnvironmentDetails.Password = this.tbPassword.Password;
        }

    }
}
